use thiserror::Error;
use tokio::sync::AcquireError;
use config::ConfigError;

#[derive(Error, Debug)]
pub enum ConversionError {
    #[error("IO error: {0}")]
    Io(#[from] std::io::Error),

    #[error("API error: {0}")]
    Api(#[from] reqwest::Error),

    #[error("Configuration error: {0}")]
    Config(#[from] ConfigError),

    #[error("Code conversion error: {0}")]
    Conversion(String),

    #[error("Test execution error: {0}")]
    Test(String),
}

impl From<AcquireError> for ConversionError {
    fn from(error: AcquireError) -> Self {
        ConversionError::Conversion(error.to_string())
    }
}

pub type Result<T> = std::result::Result<T, ConversionError>; 